#ifndef Singleton
#define Singleton

template <typename T> class CSingleton
{
public:
	static T* InstancePtr()
	{
		if( m_Instance == 0 )
		{
			m_Instance = new T;
		}
		return m_Instance;
	}

	static void DestroyInstance()
	{
		if( m_Instance != 0 )
		{
			delete m_Instance;
			m_Instance = 0;
		}
	}

private:
	static T* m_Instance;
};

template <typename T> T* CSingleton<T>::m_Instance = 0;

#endif